mui.init();
/*缓存信息*/
mui.plusReady(function(){
	mui('.clearcachebox')[0].innerHTML="0KB"
	//个人信息
	var  personalData=mui('.personal-data')[0];
	personalData.addEventListener('tap',function(e){
		webtool.openPreView('personal-data',function(wb){
			wb.show('slide-in-right',300);
		})
	})
	//账号安全
	var  accountsage=mui('.accountsage')[0];
	accountsage.addEventListener('tap',function(e){
		webtool.openPreView('accountsafe',function(wb){
			wb.show('slide-in-right',300);
		})
	})
	//黑名单
	var  blacklist=mui('.blacklist')[0];
	blacklist.addEventListener('tap',function(e){
		webtool.openPreView('blacklist',function(wb){
			wb.show('slide-in-right',300);
		})
	})
	//意见反馈
	var  feedback=mui('.feedback')[0];
	feedback.addEventListener('tap',function(e){
		webtool.openPreView('feedback',function(wb){
			wb.show('slide-in-right',300);
		})
	})
	//服务条款
	var  serviceTerm=mui('.service-term')[0];
	serviceTerm.addEventListener('tap',function(e){
		webtool.openPreView('service-term',function(wb){
			wb.show('slide-in-right',300);
		})
	})
	//关于我们
	var  aboutus=mui('.aboutus')[0];
	aboutus.addEventListener('tap',function(e){
		webtool.openPreView('aboutus',function(wb){
			wb.show('slide-in-right',300);
		})
	})
	
	/*缓存信息*/
	var downDict=null;
plus.io.requestFileSystem(plus.io.PUBLIC_DOWNLOADS, function(fs){	//缓存高于100M时自动清理
		downDict = fs.root;
		downDict.getMetadata(function(metadata){
			alert(metadata);
			mui('.clearcachebox')[0].innerHTML = parseInt(metadata.size/(1024)) + 'KB';
		},function(e){
			alert(json.stringify(e));
		},true);
	}, function (e){
		alert(json.stringify(e));
	});

	mui('.clearcacheBox')[0].addEventListener('tap',function(){
			//清除缓存
    downDict.removeRecursively(function(suc){
			cacheSize.innerHTML = "0KB";
			mui.toast('清除成功!');
			}, function(err){
			mui.toast('没有缓存数据!');
	   });
	})
})
